package com.wejoy.video.middle.station.data.enums.dict;

/**
 * @Author 张文杰
 * @PackageName video-middle-station
 * @Package com.wejoy.video.middle.station.data.enums.dict
 * @Date 2022/11/24 4:53 PM
 * @Description 部门类型枚举
 * @Version 1.0
 */
public enum EnumDeptType {
    DEPT_NULL(-1,"无"),
    DEPT_OTHER(0,"有人站点"),
    DEPT_HEADQUARTERS(1,"无人站点"),
    DEPT_SUBSIDIARY(3,"阀室"),
//    DEPT_DISPATCH_CENTER(2,"调度中心"),
//    DEPT_STATIONS(4,"场站"),
//    DEPT_BUSINESS_HALL (5,"营业厅")
    ;

    private Integer code;
    private String text;

    EnumDeptType(Integer code, String text) {
        this.code = code;
        this.text = text;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    /**
     * 通过code获得该枚举类型
     * @param code
     * @return
     */
    public static EnumDeptType getByCode(Integer code) {
        EnumDeptType[] values = EnumDeptType.values();
        for(EnumDeptType type : values) {
            if(type.code == code) {
                return type;
            }
        }
        return null;
    }

    /**
     * 通过code获得该枚举类型
     * @param text
     * @return
     */
    public static EnumDeptType getByTxt(String text) {
        EnumDeptType[] values = EnumDeptType.values();
        for(EnumDeptType type : values) {
            if(type.text.equals(text)) {
                return type;
            }
        }
        return null;
    }
}
